import http from "@/api";

interface TestParamsType {
  type: string;
}

type ResultType = {
  title: string;
  index: number;
  hotValue: string;
  link: string;
};

// type TestReturnType = {
//   code: number;
//   message: string;
//   result: ResultType[];
// };

export const testAPI = (params: TestParamsType) => {
  return http.get<ResultType[]>("/api/common/fetchHotSearchBoard", params, { loading: false });
};

// export const loginApi = (params: Login.ReqLoginForm) => {
//   return http.post<Login.ResLogin>(PORT1 + `/login`, params, { loading: false }); // 正常 post json 请求  ==>  application/json
//   // return http.post<Login.ResLogin>(PORT1 + `/login`, params, { loading: false }); // 控制当前请求不显示 loading
//   // return http.post<Login.ResLogin>(PORT1 + `/login`, {}, { params }); // post 请求携带 query 参数  ==>  ?username=admin&password=123456
//   // return http.post<Login.ResLogin>(PORT1 + `/login`, qs.stringify(params)); // post 请求携带表单参数  ==>  application/x-www-form-urlencoded
//   // return http.get<Login.ResLogin>(PORT1 + `/login?${qs.stringify(params, { arrayFormat: "repeat" })}`); // get 请求可以携带数组等复杂参数
// };
